import { round } from '@/utils/common'


// Filter for article status
export function articleStatusFilter(status) {
  const statusMap = {
    published: 'success',
    draft: 'info',
    deleted: 'danger'
  }
  return statusMap[status]
}

// Filter to uppercase the first character
export function uppercaseFirstChar(str) {
  return str.charAt(0).toUpperCase() + str.slice(1)
}

export function tofix(data, bit) {
  if (data == null || data == undefined) {
    return '--'
  }
  else if(bit) {
    return round(data, bit).toFixed(bit)
  }
  else if(bit === 0) {
    return Math.round(data)
  }
  else {
    return round(data, 2).toFixed(2)
  }
}